<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 17-4-27
 * Time: 下午3:12
 */

namespace Admin\Controller;

use Think\Controller;
class OrderController extends Controller{

    public function index()
    {

        $this->assign(array(
            'biaoti'=>'订单列表首页',
        ));
        $model=D('Order');
        $datas=$model->search();
        $this->assign(array(
            'datas'=>$datas['data'],
            'page'=>$datas['page'],
        ));

       $this->display();
    }
    public function detail()
    {
        $model=D('Order');
        $datas=$model->select();
        $goods=array();
        $num=array();
        $true=array();
        foreach($datas as $k=>&$v){
            $_gname=explode(',',$v['goods_id']);
            $gname=array();
            foreach($_gname as $k1=>$v1){
                $gname[]=getName($v1);
            }
            $name=implode(',',$gname);         //string(38) "三叶草轻跑,NIKE AIR MAX TAVAS (PS"
            $v['gname']=$name;
            $goods[]=$v['goods_id'];
            $true[]=$v['gname'];
            $num[]=$v['goods_number'];
        }
        foreach ($true as $key1 => $value1) {
            foreach ($num as $key2 => $value2) {
                if ($key1 == $key2) {
                    $arr[] = arrayToArray(explode(",", $value1), explode(",", $value2));
                }
            }
        }
        p($arr);exit;
        $this->display();
    }

    public function del($id){
        $model=M('Order');
        $model->delete($id);
        $this->success('操作成功');
    }


} 